From: Colin Walters Date: Wed, 30 Apr 2025 12:30:05 +0000 (-0400) Subject: tests/prune: Ensure /boot is big enough for 3 bootdata X-Git-Tag: archive/raspbian/2025.7-2+rpi1^2^2~6^2~4^2~36^2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=40e6606e97a54415d3ec194d2af5dd024faf380c;p=ostree.git tests/prune: Ensure /boot is big enough for 3 bootdata The size of kernel+initramfs (bootdata) for FCOS has crept up enough that it's *always* triggering this path, which perturbs the test into incorrectly triggering early prune. If we detect that /boot is too small, allocate a new loopback-mounted copy. --- diff --git a/tests/kolainst/destructive/auto-prune.sh b/tests/kolainst/destructive/auto-prune.sh index cd421dd1..418dd844 100755 --- a/tests/kolainst/destructive/auto-prune.sh +++ b/tests/kolainst/destructive/auto-prune.sh @@ -40,11 +40,35 @@ assert_not_journal_grep() { fi } -modules_dir=usr/lib/modules/`uname -r` +one_gb=$((1 * 1024 * 1024 * 1024)) -block_size=$(stat --file-system /boot -c '%s') +modules_dir=usr/lib/modules/`uname -r` kernel_size=$(stat -c '%s' ${modules_dir}/vmlinuz) initramfs_size=$(stat -c '%s' ${modules_dir}/initramfs.img) +bootdata_size=$((${kernel_size} + ${initramfs_size})) +block_size=$(stat --file-system /boot -c '%s') +total_blocks=$(stat --file-system /boot -c '%b') +# If /boot isn't big enough to hold a full 5 kernel+initramfs pairs, then +# we allocate one that is. I chose 5 just to account for overhead crudely. +required_bootdata_size=$((5 * ${bootdata_size})) +if test $((${total_blocks} * ${block_size})) -lt ${required_bootdata_size}; then + # Make a new loopback-mounted /boot that's large enough + bootimg=/var/tmp/boot.img + truncate -s ${required_bootdata_size} ${bootimg} + # Be sure to mirror existing block size + mkfs.ext4 -b ${block_size} ${bootimg} + mount -o loop ${bootimg} /var/mnt + # Copy existing boot data + cp -a /boot/* /var/mnt + umount /var/mnt + # holds a ref to /boot + systemctl stop rpm-ostreed + # Unmount it lazily anyways + umount -l /boot + # And put it in place + mount -o loop ${bootimg} /boot +fi + cat <